package cn.gson.springboot.model.service.afterservice;

import cn.gson.springboot.model.dao.afterdao.WarehouseDao;
import cn.gson.springboot.model.mapper.aftermapper.WarehouseMapper;
import cn.gson.springboot.model.pjos.Emp;
import cn.gson.springboot.model.pjos.Warehouse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class WarehouseService {

    @Autowired
    WarehouseDao dao;
    @Autowired
    WarehouseMapper mapper;

    //QA库表分页查询
    public List<Warehouse> selectBankPage(String states, String search){
        return mapper.bankPage(states,search);
    }

    //新增QA库表
    public void addBank(Warehouse bank){
        bank.setBankDelete(1);
        dao.save(bank);
    }

    //回显QA库表
    public Warehouse checkBank(Integer bankId){
        return mapper.bankByBankId(bankId);
    }

    //逻辑删除
    public void delete(Integer bankId){
        Warehouse bank = dao.findById(bankId).get();
        bank.setBankDelete(0);
        dao.save(bank);
    }
}
